How many items target currently holds - 0 for an empty list, up to target's own declared capacity once it is full.
list_length(target) -> int| Name | Type |
|---|---|
target | list |
int
How many items target currently holds - 0 for an empty list, up to target's own declared capacity (/// @capacity, or 8 if untagged) once it is full.
This is how many items are IN target right now, not its capacity - a common use is checking whether there is still room before deciding what to do next (list_length(target) < 4), or showing a count on the HUD.
/// @type {list<int>}
var scores = [10, 20, 30];
var count = list_length(scores); // 3



The empty list on the left is not part of the example above (which starts already filled) - shown first here so the picture also teaches list_length(target) tracking target as it fills, not just the single number the documented example itself returns.
Just the vector's size() - O(1), never walks the list. This is how many items are IN target right now, not target's capacity (the number `/// @capacity` declared, or 8 if untagged) - a full list has list_length(target) == its own capacity, an empty one has list_length(target) == 0.